var host = "http://api_dev.wanxikeji.cn"
const formatTime = date => {
    const year = date.getFullYear()
    const month = date.getMonth() + 1
    const day = date.getDate()
    const hour = date.getHours()
    const minute = date.getMinutes()
    const second = date.getSeconds()

    return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}

const formatNumber = n => {
    n = n.toString()
    return n[1] ? n : '0' + n
}

module.exports = {
    formatTime: formatTime
}
function myRequest(_url,_data,doSuccess) {  //后缀,数据

  wx.request({
    url: host+_url,
    method: 'POST',
    data:_data,
    success: (res) => {
      // console.log("成功");
      if( typeof(doSuccess) ==  'function'){
        doSuccess(res.data)
      }else{
        console.log("传入的不是一个方法");
      }
    }, 
   
  })
}

module.exports.myRequest = myRequest;